package com.example.android.analytics;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;
import com.google.android.apps.analytics.GoogleAnalyticsTracker;

public class AnalyticsSampleTabWidgetActivity extends TabActivity {
  GoogleAnalyticsTracker tracker;
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    tracker = GoogleAnalyticsTracker.getInstance();
    tracker.start("UA-20274206-1", 10, this);

    setContentView(R.layout.main);

    TabHost tabHost = getTabHost();
    TabHost.TabSpec spec;
    Intent intent;

    intent = new Intent().setClass(this, FirstActivity.class);
    spec = tabHost.newTabSpec("first").setIndicator("First").setContent(intent);
    tabHost.addTab(spec);

    intent = new Intent().setClass(this, SecondActivity.class);
    spec = tabHost.newTabSpec("second").setIndicator("Second").setContent(intent);
    tabHost.addTab(spec);

    tabHost.setCurrentTab(0);
  }

  @Override
  public void onDestroy() {
    tracker.stop();
    super.onDestroy();
  }
}
